﻿using Inovout.Application;
using System;
using System.ServiceProcess;

namespace Inovout.WindowsService
{
    public abstract class WindowsServiceApplication<TService> : IApplication where TService:ServiceBase
    {
        private static ApplicationWrapper applicationWrapper;
        static void Main(string[] args)
        {
            applicationWrapper = new ApplicationWrapper(this);
            applicationWrapper.Initialize();
            TService service = new TService();

            if (Environment.UserInteractive)
            {
                service.OnStart(args);
                Console.WriteLine("Press any key to stop program");
                Console.Read();
                service.OnStop();
            }
            else
            {
                ServiceBase.Run(service);
            }
        }

        public bool IsDebug
        {
            get { throw new NotImplementedException(); }
        }

        public string Title
        {
            get { throw new NotImplementedException(); }
        }

        public string Name
        {
            get { throw new NotImplementedException(); }
        }

        public string Path
        {
            get { throw new NotImplementedException(); }
        }

        public void Run()
        {
            throw new NotImplementedException();
        }

        public Castle.Core.Configuration.IConfiguration Configuration
        {
            get { throw new NotImplementedException(); }
        }
    }
}
